package com.spring.boot.dao;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.spring.boot.entity.Insured;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @Author: Daniel ZTQ
 * @Date: 2021/01/01 12:13
 * @Description: TODO
 */
@Service
public interface InsuredMapper extends BaseMapper<Insured>{
    /**
     * 根据投保人id 查询被保险人信息
     * */
    @Select("select * from insured where uid=#{uid}")
    List<Insured> getInsuredByUid(@Param("uid")String uid);

    /**
     * 根据投保人id和身份证号查询被保险人信息
     * */
    @Select("select * from insured where uid=#{uid} and identity_card=#{identityCard}")
    List<Insured> getInsuredByUidAndidentityCard(@Param("uid")String uid,@Param("identityCard")String identityCard);

    /**
     * 根据身份证号查询被保险人信息
     * */
    @Select("select * from insured where identity_card=#{identityCard}")
    List<Insured> getInsuredByIdentityCard(@Param("identityCard")String identityCard);

    /**
     * 查询所有被保险人信息
     * */
    @Select("select * from insured")
    List<Insured> getInsuredAll();
}
